package com.demo.crm.springboot3security.entity;

import java.util.Set;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.RelationManyToMany;
import com.mybatisflex.annotation.Table;

import lombok.Data;

@Data
@Table("roles")
public class Role {
    @Id
    private Long id;

    @Column
    private String name;

    @RelationManyToMany(joinTable = "role_permissions", selfField = "id", targetField = "id", joinSelfColumn = "role_id", joinTargetColumn = "permission_id"
    )
    private Set<Permission> permissions;

    @RelationManyToMany(joinTable = "user_roles", selfField = "id", targetField = "id", joinSelfColumn = "role_id", joinTargetColumn = "user_id")
    private Set<User> users;
} 